## # A tibble: 81 × 3
##    site                   freq   pop
##    <chr>                 <dbl> <dbl>
##  1 Rib Lake WWTF           1.4   386
##  2 Neopit WWTF             1    1000
##  3 Wolf River Ranch WWTF   1    1000
##  4 Red Cliff WWTP          1.2  1900
##  5 Spencer WWTP            1.3  2000
##  6 Washburn WWTP           1    2200
##  7 Hayward WPCF            1.3  2375
##  8 Keshena WWTF            1    2500
##  9 Spooner WWTP            1    2700
## 10 Mondovi WWTF            1    2800
## # … with 71 more rows
## 
## Call:
## lm(formula = missed_percent ~ MSE + window + quant + FlagType, 
##     data = .)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.5954 -0.3097  0.0634  0.3445  1.4235 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)   
## (Intercept)              1.637168   1.799693   0.910  0.36921   
## MSE                      0.171105   0.051553   3.319  0.00212 **
## window                  -0.014304   0.007813  -1.831  0.07567 . 
## quant                   -1.753772   1.038178  -1.689  0.10006   
## FlagTypeflag.ntile.Pval  0.213933   0.217533   0.983  0.33213   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6075 on 35 degrees of freedom
## Multiple R-squared:  0.8401, Adjusted R-squared:  0.8218 
## F-statistic: 45.96 on 4 and 35 DF,  p-value: 1.84e-13

## # A tibble: 1 × 1
##   `mean(abs(flag_error) > edgeThresh, na.rm = TRUE)`
##                                                <dbl>
## 1                                             0.0310

## # A tibble: 1 × 1
##   `mean(missed_percent == 0)`
##                         <dbl>
## 1                       0.167

## # A tibble: 1 × 1
##   `mean(missed_percent == 0)`
##                         <dbl>
## 1                       0.309

## 
## Call:
## lm(formula = missed_percent ~ FlagType + window + quant + sample_rate + 
##     pop + MSE, data = ., weights = num_flags)
## 
## Weighted Residuals:
##     Min      1Q  Median      3Q     Max 
## -79.738 -14.756   2.896  23.931 122.590 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             -4.507319   0.732706  -6.152 1.05e-09 ***
## FlagTypeflag.ntile       0.199273   0.251935   0.791    0.429    
## FlagTypeflag.ntile.Pval  0.448996   0.317234   1.415    0.157    
## window                   0.001122   0.003593   0.312    0.755    
## quant                    0.112472   0.765338   0.147    0.883    
## sample_rate              0.093204   0.066562   1.400    0.162    
## pop                      0.886151   0.137856   6.428 1.87e-10 ***
## MSE                      0.237068   0.005806  40.830  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 34.24 on 1189 degrees of freedom
##   (19 observations deleted due to missingness)
## Multiple R-squared:  0.6764, Adjusted R-squared:  0.6745 
## F-statistic:   355 on 7 and 1189 DF,  p-value: < 2.2e-16
## 
## Call:
## lm(formula = missed_percent ~ FlagType + window + quant + sample_rate + 
##     pop + MSE, data = ., weights = 1/(Var + 1))
## 
## Weighted Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.5088 -0.3359 -0.0048  0.3408  2.7035 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             -0.4751744  0.4199523  -1.131    0.258    
## FlagTypeflag.ntile      -0.1292648  0.1533261  -0.843    0.399    
## FlagTypeflag.ntile.Pval  0.0106984  0.1482819   0.072    0.942    
## window                  -0.0007534  0.0018470  -0.408    0.683    
## quant                    0.0222290  0.3879586   0.057    0.954    
## sample_rate              0.0075672  0.0333262   0.227    0.820    
## pop                      0.1386288  0.0777969   1.782    0.075 .  
## MSE                      0.1468614  0.0049289  29.796   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6941 on 1165 degrees of freedom
##   (43 observations deleted due to missingness)
## Multiple R-squared:  0.4647, Adjusted R-squared:  0.4615 
## F-statistic: 144.5 on 7 and 1165 DF,  p-value: < 2.2e-16